package com.cy.pj.common.pojo;

import com.cy.pj.common.util.PageUtil;
import com.github.pagehelper.ISelect;
import lombok.Data;

import java.io.Serializable;

/**
 * 定义统一响应API，对服务端响应到客户端的数据进行统一标准设计
 */
@Data
public class JsonResult implements Serializable {
    private static final long serialVersionUID=-456l;
    private Integer state=1;
    private String message="OK";
    private Object data;
    public JsonResult(){}
    public JsonResult(String  message){
        this.message=message;
    }
    public JsonResult(Object data){
        this.data=data;
    }
    public JsonResult(ISelect iSelect){
        this.data= PageUtil.startPage().doSelectPageInfo(iSelect);
    }
    public JsonResult(Throwable e){
        this.state=0;
        this.message=e.getMessage();
    }
}
